import request from '@/utils/request';

export async function queryDayRule(url, params) {
  return request(url, {
    params,
  });
}
export async function storeList(params) {
  return request(`/store/store/list`, {
    params
  });
}
export async function getPreStore(params) {
  console.log(params);
  const limit = params.pageSize;
  const page = params.current;
  const my_params = {
    limit: limit,
    page: page,
  };
  Object.assign(params, my_params);
  delete params.current;
  delete params.pageSize;
  return request(`store/statistics/all/recharge/pre`, {
    params,
  });
}

export async function getChangePrePage(params,id) {
  const limit = params.pageSize;
  const page = params.current;
  const my_params = {
    limit: limit,
    page: page,
    preId:id
  };
  Object.assign(params, my_params);
  delete params.current;
  delete params.pageSize;
  return request(`store/statistics/all/recharge/changePrePage`, {
    params,
  });
}

export async function getAllStore(payload, params) {
  return request(`store/statistics/all/recharge/${payload}`, {
    params,
  });
}
export async function exportRecharge(params) {
  return request(
    `/store/statistics/all/recharge/export/${params.type}`
    , {
      method: 'GET',
      responseType: 'blob',
      params
    },
  );
}
export async function changePre(params) {
  return request(`store/statistics/all/recharge/changePre`, {
    method: 'POST',
    data: {
      ...params,
    },
  });
}
export async function exportPreCount(params) {
  return request(
    `/store/statistics/all/recharge/exportCount/pre`
    , {
      method: 'GET',
      responseType: 'blob',
      params
    },
  );
}
